<template>
  <!-- 辅导员详情 -->
  <div class="app-container">
    <div class="title-tips" v-if="timeHorizon.startTime && timeHorizon.endTime">
      温馨提示：毕业离校时间为{{ timeHorizon.startTime }}-{{
        timeHorizon.endTime
      }}，请在该时间内进行离校操作
    </div>
    <el-row>
      <el-form
        :model="queryParams"
        label-width="90px"
        ref="queryForm"
        :inline="true"
        v-show="showSearch"
      >
        <el-col :span="6">
          <el-form-item label="毕业年份">
            <el-select
              v-model="queryParams.dgsId"
              clearable
              placeholder="请选择"
            >
              <el-option
                v-for="item in yearList"
                :key="item.DGS_ID"
                :label="item.GRAD_YEAR"
                :value="item.DGS_ID"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="学位">
            <el-select
              v-model="queryParams.edLevel"
              clearable
              placeholder="请选择"
            >
              <el-option
                v-for="dict in dict.type.basic_speciality_type"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="毕业生状态">
            <el-select
              v-model="queryParams.gdpStatus"
              clearable
              placeholder="请选择"
            >
              <el-option
                v-for="dict in dict.type.dep_grad_status"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="银行卡状态">
            <el-select
              v-model="queryParams.bankStatus"
              clearable
              placeholder="请选择"
            >
              <el-option
                v-for="dict in dict.type.basic_student_bank_status"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="院系">
            <el-select
              v-model="queryParams.deptId"
              clearable
              placeholder="请选择"
              @change="handSpeciality"
            >
              <el-option
                v-for="dict in classTreeList"
                :key="dict.id"
                :label="dict.label"
                :value="dict.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="专业">
            <el-select
              v-model="queryParams.specialityId"
              clearable
              placeholder="请选择"
              @change="changeGrade"
            >
              <el-option
                v-for="dict in specialityList"
                :key="dict.VALUE"
                :label="dict.TITILE"
                :value="dict.VALUE"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item prop="gradeId" label="年级">
            <el-select
              v-model="queryParams.gradeId"
              placeholder="请选择"
              @change="changeGrade"
              clearable
              class="elSelect"
            >
              <el-option
                v-for="item in gradeDate"
                :key="item.VALUE"
                :label="item.TITILE"
                :value="item.VALUE"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="班级">
            <el-select
              v-model="queryParams.classId"
              clearable
              placeholder="请选择"
            >
              <el-option
                v-for="dict in classListType"
                :key="dict.VALUE"
                :label="dict.TITLE"
                :value="dict.VALUE"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="学生注册号">
            <el-input
              v-model="queryParams.regCode"
              placeholder="请输入注册号"
              clearable
            />
          </el-form-item>
        </el-col>

        <el-col :span="6" style="float: right; text-align: right">
          <el-form-item>
            <div>
              <el-button
                type="primary"
                icon="el-icon-search"
                @click="onSearch"
                size="mini"
                >搜索</el-button
              >
              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
                >重置</el-button
              >
            </div>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
    <el-button type="primary" @click="goBack">返回</el-button>
    <div style="float: right">
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            size="mini"
            @click="handleAdd"
            v-hasPermi="['departure:gradStuRoster:add']"
            >新增离校学生</el-button
          >
        </el-col>

        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            size="mini"
            @click="upload.open = true"
            :disabled="operate"
            v-hasPermi="['departure:clrGradStuRoster:import']"
            >批量导入书费退费</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['departure:clrGradStuRoster:view']"
            >下载书费导入模板</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            size="mini"
            @click="uploadBack.back = true"
            v-hasPermi="['departure:clrGradStuRoster:import']"
            >批量导入银行卡信息</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleBack"
            v-hasPermi="['departure:clrGradStuRoster:view']"
            >下载银行卡模板</el-button
          >
        </el-col>
      </el-row>
    </div>
    <el-table v-loading="loading" :data="gradStuRosterList">
      <el-table-column
        label="学院专业班级"
        align="center"
        show-overflow-tooltip
        prop="dsc"
      >
      </el-table-column>
      <el-table-column label="注册号" align="center" prop="regCode">
      </el-table-column>
      <el-table-column label="学生姓名" align="center" prop="studentName">
      </el-table-column>
      <el-table-column label="学生状态" align="center" prop="gradScope">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.dep_grad_scope"
            :value="scope.row.gradScope"
          />
        </template>
      </el-table-column>
      <el-table-column label="学位" align="center" prop="edLevel" width="100">
      </el-table-column>
      <el-table-column
        label="毕业生状态"
        align="center"
        prop="gdpStatus"
        width="100"
      >
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.dep_grad_status"
            :value="scope.row.gdpStatus"
          />
        </template>
      </el-table-column>
      <el-table-column
        label="毕业离校确认时间"
        align="center"
        prop="gdpTime"
        width="180"
      >
      </el-table-column>
      <el-table-column label="书费退费" align="center" prop="rfAmount">
      </el-table-column>
      <el-table-column label="银行卡号" align="center" prop="bankStatus">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.basic_student_bank_status"
            :value="scope.row.bankStatus"
          />
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="260">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['departure:gradStuRoster:query']"
            >详情</el-button
          >
          <el-button
            size="mini"
            type="text"
            @click="handleEdit(scope.row)"
            v-hasPermi="['departure:clrGradStuRoster:edit']"
            :disabled="operate"
            >修改书费</el-button
          >
          <el-button
            size="mini"
            type="text"
            @click="handleCancel(scope.row)"
            v-hasPermi="['departure:gradStuRoster:remove']"
            >取消离校</el-button
          >
          <el-button
            size="mini"
            type="text"
            @click="handleVerify(scope.row)"
            v-hasPermi="['departure:clrGradStuRoster:configGrad']"
            >确认离校</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改毕业离校学生对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="注册号" prop="dgsId">
          <el-input v-model.trim="regCode" placeholder="请输入学生注册号" />
        </el-form-item>
        <el-row>
          <div v-if="form.dsc">
            <el-col :span="18"
              ><p>{{ form.dsc }}</p></el-col
            >
            <el-col :span="6"
              ><p>{{ form.studentName }}</p></el-col
            >
            <el-col :span="6"
              ><p>入学年份:{{ form.gradeName }}年</p></el-col
            >
            <el-col :span="4"
              ><p>{{ form.asys }}年制</p></el-col
            >
            <el-col :span="4"
              ><p>{{ form.education }}</p></el-col
            >
            <el-col :span="8"
              ><p>学生状态：{{ studentStatusData.toString() }}</p></el-col
            >
          </div>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormAdd" :disabled="addLoading"
          >确 定</el-button
        >
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 添加或修改毕业离校学生对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="editOpen"
      width="40%"
      append-to-body
    >
      <el-form ref="book" :model="book" label-width="80px" :rules="rules">
        <el-form-item label="书费退费" prop="rfAmount">
          <el-input
            v-model.trim="book.rfAmount"
            type="number"
            placeholder="请输入书费退费"
            @input="limitInput($event, 'rfAmount')"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="editOpen = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 批量导入书费退费 -->
    <el-dialog
      title="批量导入书费退费"
      :visible.sync="upload.open"
      width="400px"
      append-to-body
    >
      <div style="float: left; height: 30px; line-height: 30px">上传文件：</div>
      <el-upload
        ref="uploads"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="onSuccess"
        :auto-upload="false"
      >
        <div class="el-upload__text">
          <i class="el-icon-upload"></i>
          <em>点击上传</em>
        </div>
        <span style="height: 30px; line-height: 30px; margin-left: 10px"
          >仅支持 xls格式文件</span
        >
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitUpload" :disabled="submitLock">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 批量导入银行卡信息 -->
    <el-dialog
      title="excel导入银行卡信息"
      :visible.sync="uploadBack.back"
      width="400px"
      append-to-body
    >
      <div style="float: left; height: 30px; line-height: 30px">上传文件：</div>
      <el-upload
        ref="uploadBacks"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="uploadBack.headers"
        :action="uploadBack.url"
        :disabled="uploadBack.isUploading"
        :on-progress="handleFileUploadBack"
        :on-success="onSuccessBack"
        :auto-upload="false"
      >
        <div class="el-upload__text">
          <i class="el-icon-upload"></i>
          <em>点击上传</em>
        </div>
        <span style="height: 30px; line-height: 30px; margin-left: 10px"
          >仅支持 xls格式文件</span
        >
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitUploadBack" :disabled="submitLock">确 定</el-button>
        <el-button @click="uploadBack.back = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="上传结果"
      :visible.sync="uploadData"
      width="500px"
      append-to-body
    >
      <div>
        共录入数据{{ studenData.totalSize }}条，上传成功{{
          studenData.successSize
        }}条，上传失败{{ studenData.errorSize }}条，下载上传结果查看。
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="importData">下载上传结果</el-button>
        <el-button @click="uploadData = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  clrGradStuRosterList,
  clrGradStuRosterPut,
  configGrad,
} from "@/api/departure/instructor";
import {
  addGradStuRoster,
  delGradStuRoster,
} from "@/api/departure/gradStuRoster";
import { getDicts } from "@/api/system/dict/type";
import { getToken } from "@/utils/auth";
import { classTree, studentGrad } from "@/api/information/studentInfor";
import { getClassSelect } from "@/api/information/classInfor";
import { getGradeSelect } from "@/api/information/gradeInfor";
import {
  getGradYearSelector,
  getSettlementTime,
} from "@/api/departure/gradsettings";
import { getSpecialityByDeptId } from "@/api/information/unitMajor";
import moment from "moment";
export default {
  name: "details",
  dicts: [
    "dep_grad_status",
    "basic_student_bank_status",
    "dep_grad_scope",
    "basic_speciality_type",
  ],

  data() {
    return {
      data: "",
      regCode: "",
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 毕业离校学生表格数据
      gradStuRosterList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      editOpen: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dgsId: null,
        gdpStatus: null,
        specialityId: undefined,
        classId: undefined,
      },
      uploadData: false,
      submitLock: false,
      studenData: {},
      timeForm: {},
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: true,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url:
          process.env.VUE_APP_BASE_API + "/departure/clrGradStuRoster/importSf",
      },
      uploadBack: {
        // 是否显示弹出层（用户导入）
        back: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: true,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/basicdata/bankInfo/import",
      },
      // 表单参数
      form: {},
      book: {
        rfAmount: "",
      },
      // 表单校验
      rules: {
        rfAmount: [
          { required: true, message: "请输入退费金额", trigger: "bulr" },
        ],
      },
      addLoading: false,
      yearList: [],
      timeHorizon: {},
      classListType: [],
      classTreeList: [],
      specialityList: [],
      gradeDate: [],
      operate: false,
      studentStatusData: "",
    };
  },
  watch: {
    regCode(curVal, oldVal) {
      // 实现input连续输入，只发一次请求
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        this.handleChangeName(curVal);
      }, 500);
    },
  },
  created() {
    getGradYearSelector().then((res) => {
      this.yearList = res.data;
      this.queryParams.dgsId = res.data[0].DGS_ID;
      this.getList();
      this.getTitme(this.queryParams.dgsId);
    });

    // this.getList();

    classTree().then((response) => {
      this.classTreeList = response.data;
    });
  },
  methods: {
    // 返回上一级
    goBack() {
      this.$router.go(-1);
    },
    getTitme(data) {
      if (data) {
        getSettlementTime(data).then((res) => {
          console.log(res, "时间");
          if (res.code == 200) {
            this.timeHorizon = res.data;
            // const startTime = moment(
            //   this.timeHorizon.startTime,
            //   "YYYY年MM月DD日"
            // ).format("YYYY-MM-DD");
            // const endTime = moment(
            //   this.timeHorizon.endTime,
            //   "YYYY年MM月DD日"
            // ).format("YYYY-MM-DD");
            // const now = new Date();
            // const year = now.getFullYear();
            // const month = (now.getMonth() + 1).toString().padStart(2, "0");
            // const day = now.getDate().toString().padStart(2, "0");
            // const dataDay = year + "-" + month + "-" + day;
            if (
              new Date().getTime() >= new Date(this.timeHorizon.startTime).getTime() &&
              new Date().getTime() <= new Date(this.timeHorizon.endTime).getTime()
            ) {
              this.operate = false;
            } else {
              this.operate = true;
            }
          } else {
            this.operate = true;
          }
        });
      }
    },
    // 获取搜索表单提交的数据
    onSearch() {
      // 查询条件和分页数据合并
      this.getList();
      this.getTitme(this.queryParams.dgsId);
    },
    // 重置
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        dgsId: null,
        specialityId: undefined,
        gdpStatus: null,
        classId: undefined,
      };
      this.queryParams.dgsId = this.yearList[0].DGS_ID;
      this.queryParams.pageNum = 1;
      this.queryParams.pageSize = 10;
      this.classListType = [];
      this.gradeDate = [];
      this.specialityList = [];
      this.onSearch();
    },
    //限制只能输入两位小数
    limitInput(value, name) {
      this.book[name] =
        ("" + value) // 第一步：转成字符串
          .replace(/[^\d^\.]+/g, "") // 第二步：把不是数字，不是小数点的过滤掉
          .replace(/^0+(\d)/, "$1") // 第三步：第一位0开头，0后面为数字，则过滤掉，取后面的数字
          .replace(/^\./, "0.") // 第四步：如果输入的第一位为小数点，则替换成 0. 实现自动补全
          .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 第五步：最终匹配得到结果 以数字开头，只有一个小数点，而且小数点后面只能有0到2位小数
    },
    getClassList() {
      getClassSelect({
        gradeId: this.queryParams.gradeId,
        specialtyId: this.queryParams.specialityId,
      }).then((res) => {
        console.log(res, "班级");
        this.classListType = res.data;
      });
    },
    // 年级
    getGradeInfor() {
      getGradeSelect().then((response) => {
        this.gradeDate = response.data;
      });
    },
    changeGrade(value) {
      console.log(value, "ceeee");
      if (value != undefined) {
        if (this.queryParams.specialityId && this.queryParams.gradeId) {
          this.getClassList();
          this.classListType = [];
          this.queryParams.classId = "";
        } else {
          if (!value) {
            this.classListType = [];
            this.queryParams.classId = "";
          }
        }
      }
    },
    async handSpeciality() {
      this.queryParams.specialityId = "";
      this.queryParams.classId = "";
      this.classListType = [];
      this.getSpeciality();
      this.getGradeInfor();
    },
    // 专业
    async getSpeciality() {
      if (this.queryParams.deptId) {
        await getSpecialityByDeptId({ deptId: this.queryParams.deptId }).then(
          (res) => {
            if (res.code == "200") {
              this.specialityList = res.data;
            } else {
              this.specialityList = [];
            }
          }
        );
      } else {
        this.specialityList = [];
      }
    },
    handleChangeName(value, oldVal) {
      console.log(this.form, value, "注册号");
      if (value === "") {
        return false;
      } else {
        studentGrad(value).then((response) => {
          this.form = response.data;
          getDicts("dep_grad_scope").then((res) => {
            let data = this.form.studentStatus.split(",");
            this.studentStatusData = res.data
              .filter((item) => data.includes(item.dictValue))
              .map((item) => item.dictLabel);
          });
        });
      }
    },
    cancel() {
      this.regCode = "";
      this.form = {};
      this.open = false;
    },
    /** 查询毕业离校学生列表 */
    getList() {
      this.loading = true;
      clrGradStuRosterList(this.queryParams).then((response) => {
        this.gradStuRosterList = response.rows;
        this.gradStuRosterList.forEach((item) => {
          item.gradScope = item.gradScope.split(",");
        });
        this.total = response.total;
        this.loading = false;
      });
    },
    // 新增离校学生操作按钮
    handleAdd() {
      this.regCode = "";
      this.open = true;
      this.title = "新增";
    },
    // 修改退费操作按钮
    handleEdit(row) {
      this.editOpen = true;
      this.book = JSON.parse(JSON.stringify(row));
      this.title = "修改书费";
    },
    /** 详情 */
    handleUpdate(row) {
      this.$router.push({
        path: "/departure/gradStuRoster/departureDetails",
        query: { dgsrId: row.dgsrId },
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["book"].validate((valid) => {
        if (valid) {
          clrGradStuRosterPut(this.book).then((response) => {
            this.$modal.msgSuccess("修改成功");
            this.editOpen = false;
            this.getList();
          });
        }
      });
    },
    /** 提交按钮新增 */
    submitFormAdd() {
      if (this.regCode) {
        if (this.addLoading) return;

        this.addLoading = true;
        try {
          this.form.dgsId = this.queryParams.dgsId;
          this.$refs["form"].validate((valid) => {
            if (valid) {
              addGradStuRoster(this.form).then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.addLoading = false;
                this.open = false;
                this.regCode = "";
                this.form = {};
                this.getList();
              });
            }
          });
          // 处理成功逻辑
        } catch (error) {
          // 处理错误
        } finally {
          this.addLoading = false;
        }
      } else {
        this.$modal.msgError("请填写注册号");
      }
    },
    handleFileUploadProgress() {

      this.upload.isUploading = true;
    },
    onSuccess(response) {
      if (response.code == 200) {
        this.$message.success("文件上传成功");
        this.studenData = response.data;
        this.importUrl = response.url;
        this.upload.isUploading = false;
        this.$refs.uploads.clearFiles();
        this.upload.open = false;
        this.uploadData = true;
        this.getList();
      } else {
        this.studenData = {};
        this.upload.isUploading = false;
        this.$refs.uploads.clearFiles();
        this.upload.open = false;
        this.uploadData = true;
        this.$message.error(response.msg);
        // this.getList();
      }
    },
    submitUpload() {
       // 使用防抖确保只提交一次
    if (!this.submitLock) {
      this.submitLock = true;
      this.$refs.uploads.submit();
      
      // 3秒后重置锁，防止长时间锁定
      setTimeout(() => {
        this.submitLock = false;
      }, 5000);
    }
     
      // this.$refs.uploads.clearFiles();
    },
    handleFileUploadBack() {
      this.upload.isUploading = true;
    },
    onSuccessBack(response) {
      if (response.code == 200) {
        this.$message.success("文件上传成功");
        this.studenData = response.data;
        this.importUrl = response.url;
        this.uploadBack.isUploading = false;
        this.$refs.uploadBacks.clearFiles();
        this.uploadBack.back = false;
        this.uploadData = true;
        this.getList();
      } else {
        this.studenData = {};
        this.uploadBack.isUploading = false;
        this.$refs.uploadBacks.clearFiles();
        this.uploadBack.back = false;
        // this.uploadData = true;
        this.$message.error(response.msg);
        // this.getList();
      }
    },
    submitUploadBack() {
      
       // 使用防抖确保只提交一次
    if (!this.submitLock) {
      this.submitLock = true;
      this.$refs.uploadBacks.submit(); 
      
      // 3秒后重置锁，防止长时间锁定
      setTimeout(() => {
        this.submitLock = false;
      }, 5000);
    }
      // this.$refs.uploadBacks.clearFiles();
    },
    importData() {
      let link = document.createElement("a");
      //创建一个a标签
      link.style.display = "none";
      //将a标签隐藏
      link.href = process.env.VUE_APP_BASE_API + this.importUrl;
      //给a标签添加下载链接  "域名+接口"  safe是一个动态的域名  后面的接口替换成你自己的下载接口
      link.setAttribute("download", "下载上传结果");
      // 此处注意，要给a标签添加一个download属性，属性值就是文件名称 否则下载出来的文件是没有属性的，空白白
      document.body.appendChild(link);
      //将上面创建的a标签加入到body的尾部
      link.click();
      //执行a标签
    },
    handleVerify(row) {
      this.$modal
        .confirm(
          '是否确认学生姓名为"' + row.studentName + '"确认离校的数据项？'
        )
        .then(function () {
          return configGrad(row.dgsrId);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("确认成功");
        })
        .catch(() => {});
    },
    /** 取消按钮 */
    handleCancel(row) {
      const dgsrIds = row.dgsrId || this.ids;
      this.$modal
        .confirm(
          '是否确认取消毕业离校学生姓名为"' + row.studentName + '"的数据项？'
        )
        .then(function () {
          return delGradStuRoster(dgsrIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "/departure/clrGradStuRoster/importSfTemplate",
        {
          ...this.queryParams,
        },
        `书费导入模板${new Date().getTime()}.xlsx`
      );
    },
    /** 导出按钮操作 */
    handleBack() {
      this.download(
        "/basicdata/bankInfo/importTemplate",
        {
          ...this.queryParams,
        },
        `下载银行卡模板${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style scoped>
.el-upload__text {
  color: #0077fa;
  border: 1px solid #0077fa;
  background-color: #dbdcdc;
  width: 100px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  float: left;
}
::v-deep input::-webkit-outer-spin-button,
::v-deep input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
::v-deep input[type="number"] {
  -moz-appearance: textfield;
  appearance: none;
}
::v-deep inpit {
  border: none;
}
.title-tips {
  text-align: center;
  border: 1px solid #d0d0d0;
  padding: 5px;
  margin-bottom: 5px;
}
</style>
